# 导入 pymongo 库
from pymongo import MongoClient
from pymongo.collection import Collection
from pymongo.database import Database

def get_token(username="test1"):
    # 远程连接mongodb 数据库
    client = MongoClient("mongodb://49.233.108.117:27017")
    # 连接 node_club_dev 库
    db: Database = client['node_club_dev']
    # 连接 表
    table: Collection = db['users']

    user = table.find_one({'name': username})
    # print(user['accessToken'])
    usetoken = user['accessToken']
    # 关闭连接
    client.close()
    return usetoken
